<?
    cria_variaveis($_POST,$_GET,$_FILES); 
?>
<p class="titulo" align="center"><?php echo $msg->get('SPLINE_MSG_02') ?></p>
<p class="subtitulo" align="center"><?php echo $msg->get('SPLINE_MSG_03') ?></p>
<p>
<div class="tabbar">
    <ul>
    <li><a href="index.php?inc=spline.php&modo=material"<?php if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "material") echo " class=\"tabact\""; ?>><?php echo $msg->get('Material_Teorico') ?></a></li>
    <li><a href="index.php?inc=spline.php&modo=exemplo"<?php if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo") echo " class=\"tabact\""; ?>><?php echo $msg->get('Exemplos_Prontos') ?></a></li>
    <li><a href="index.php?inc=spline.php&modo=teclado"<?php if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "teclado") echo " class=\"tabact\""; ?>><?php echo $msg->get('Entrada_Teclado') ?></a></li>
    </ul>
</div>
<div id="cas">
<?php
if (!isset($Calcular)) {
    if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "material")
    {
        require_once("./classes/upload.php");
        $uploads = new Upload();
        $uploads->Lista("interpolacao");
    }
    else if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo" && !isset($opcao_execucao)) { //leitura de dados via banco de dados - modulo de exemplos e exercicios
	    include "exibe_prob_spline_xml.php";
	}
	else if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "teclado" || isset($opcao_execucao)) {
	   if(strlen($opcao_execucao) == 0) {
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<br>";
		echo "".$msg->get('SPLINE_MSG_04')."<br><br>";
		echo "<input type=radio name=opcao_execucao value=0>".$msg->get('SPLINE_MSG_05')."<br>"; // 0 para caso discreto, 1 para caso continuo 
		echo "<input type=radio name=opcao_execucao value=1>".$msg->get('SPLINE_MSG_06')."<br><br>";
		echo "<input type=hidden name=executar value=sim>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_02').">";
		echo "</form>"; 
		echo "<form enctype=multipart/form-data action=index.php?opcao=spline method=post>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_03').">";
		echo "</form>";
	   }
       else if ((!isset($n) && !isset($funcao) && !isset($a) && !isset($b)) || !checaNumerico($n) || ($opcao_execucao == 1 && (!checaNumerico($a) || !checaNumerico($b))))
       {
        if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo")
            verificaBib($xml_file);
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<br>";
		echo "".$msg->get('SPLINE_MSG_07')."<br>";
		echo "<input type=text size=3 maxlength=5 name=n><br><br>";
		if ($opcao_execucao==1) {
		   echo "<a href=javascript:winopen('ajuda/funcoesphp.php')>".$msg->get('G_MSG_29')."</a>";	
		   echo "<p>";
		   echo "".$msg->get('SPLINE_MSG_09')."<br>";
		   echo "f(x)= <input type=text size=60 maxlength=100 name=funcao value=\"".$funcao."\"><br>";
		   echo "<br>";
		   echo "".$msg->get('SPLINE_MSG_10')."<br>";
		   echo "[<input type=text size=5 maxlength=5 name=a>,<input type=text size=5 maxlength=5 name=b>]";
		   echo "<br><br>";
		}// end if
		echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
		echo "<input type=hidden name=executar value=sim>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_02').">";
		echo "</form>"; 
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_03').">";
		echo "</form>";
	   }
	   else if ( ($opcao_execucao==1) and (strlen($distribuicao)==0) ) {
        if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo")
            verificaBib($xml_file);
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<br>";
		echo "".$msg->get('SPLINE_MSG_11')."".($n)."".$msg->get('SPLINE_MSG_12')." [&nbsp<input type=text size='4' maxlength='5' name=a value=".($a).">&nbsp,";
		echo "&nbsp<input type=text size='4' maxlength='5' name=b value=".($b).">&nbsp] :";
		echo "<input type=hidden size='4' maxlength='5' name=n value=".($n).">";
		echo "<br> <br>";
		echo "<input type=radio name=distribuicao value=1 unchecked> ".$msg->get('SPLINE_MSG_13')." <br>";
		echo "<input type=radio name=distribuicao value=2 unchecked> ".$msg->get('SPLINE_MSG_14')." <a href=\"javascript:void(0)\" onClick=\"window.open('info.php?topico=chebyshev', 'Informacoes', 'toolbar=no, location=no, directories=no, scrollbars=yes,resizable=yes,menubar=no,width=400,height=300')\"><img src=\"imagens/info.gif\" border=\"0\"></a><br>";
		echo "<br>";
		echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
		echo "<input type=hidden name=n value=".($n).">";
		echo "<input type=hidden name=funcao value=\"".($funcao)."\">";
		echo "<input type=hidden name=a value=".($a).">";
		echo "<input type=hidden name=b value=".($b).">";
		echo "<input type=hidden name=executar value=sim>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_02').">";
		echo "</form>"; 
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_03').">";
		echo "</form>";
	   }
	   else { // Pagina final, para a entrada dos valores de x e y que necessitem ser digitados
        if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo")
            verificaBib($xml_file);
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
		echo "<input type=hidden name=distribuicao value=".($distribuicao).">";
		echo "<input type=hidden name=funcao value=\"".($funcao)."\">";
		echo $msg->get('SPLINE_MSG_15');
		echo "<input type=text size='4' maxlength='5' name=n value=".($n)." readonly>";
		echo "<br>";
		if ($opcao_execucao ==1) {
			   echo "<br><br>".$msg->get('SPLINE_MSG_17')."<br>";
			   echo "f(x)= ".$funcao;
			}	   
		if ( ($opcao_execucao == 1) && ($distribuicao==1) ) { // distribuicao uniforme 
		   echo "<br> <br>";
		   //echo "".(SPLINE_MSG_18)." [&nbsp<input type=text size='4' maxlength='5' name=a value=".($a).">&nbsp,";
		   //echo "&nbsp<input type=text size='4' maxlength='5' name=b value=".($b).">&nbsp] :";
           echo $msg->get('SPLINE_MSG_18')." [ $a , $b ] :";
           echo "<input type=hidden name=a value=$a>";
           echo "<input type=hidden name=b value=$b>";
		   $fracao = ($b - $a) / ($n - 1);
		   eval ('$X[0]=$a;$x=$X[0];$Y[0]='.normaliza_funcao($funcao).';');
		   for ($i = 1; $i < $n; $i++) {
			  eval ('$X[$i]=$X[$i-1]+$fracao;$x=$X[$i];$Y[$i]='.normaliza_funcao($funcao).';');
		   } // end for
		} // end if
		else if ( ($opcao_execucao == 1) && ($distribuicao==2) ) { // distribuicao de chebyshev
		   echo "<br> <br>";
		   echo "".$msg->get('SPLINE_MSG_18')." [ $a , $b ] :";
           echo "<input type=hidden name=a value=$a>";
           echo "<input type=hidden name=b value=$b>";
		   for ($i = 0; $i < $n; $i++) {
			  $X[$i] = ( ($a + $b)/2 ) +( ($a - $b)/2 ) * cos (((2*($i+1)-1) / (2*$n)) * M_PI);
			  eval ('$x=$X[$i];$Y[$i]='.normaliza_funcao($funcao).';');
			   } // end for
			   for ($tam=$n; $tam>1; $tam--){ //ordena�o do vetor
				  for ($i=0; $i<$tam-1; $i++) {
					  if ( $X[$i] > $X[$i+1] ) {
						 $aux = $X[$i];
						 $X[$i] = $X[$i+1];
						 $X[$i+1] = $aux;
						 $aux = $Y[$i];
						 $Y[$i] = $Y[$i+1];
						 $Y[$i+1] = $aux;
					  } //end if
				  } //end for j
			   } // end for i
		} // end else
		echo "<br><br>".$msg->get('SPLINE_MSG_19')."<br>";
		echo "<br>";
		for ($i=0; $i<$n; $i++) {
			echo "x".$i." = <input type=text size='6' maxlength='30' name=x[".($i)."] value=".($X[$i]).">";
			echo " y".$i." = <input type=text size='6' maxlength='30' name=y[".($i)."] value=".($Y[$i])."><br>";
		} //for
		echo "<br>";
		echo "".$msg->get('SPLINE_MSG_20')."<input type=text size='6' maxlength='8' name=valor value=".($valor).">";
		echo "<p><p>";
		echo "<p>";
		if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
		{
			echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
			echo "<input type=\"hidden\" name=\"indice\" value=\"$indice\">";
			echo "<input type=\"hidden\" name=\"navegacao\" value=\"sim\">";
		}
		echo "<input class=button type=submit name=Calcular value=".$msg->get('G_MSG_04').">";
		echo "<br>";
		echo "</form>";
        echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
		echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_03').">";
		echo "</form>";
		if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
		{
			echo "<form name=\"exemplos\" enctype=\"multipart/form-data\" method=\"post\">";
			echo "<script language=\"javascript\" type=\"text/javascript\">\n";
			echo "function criarLinks(value) {\n";
			echo "document.exemplos.indice.value = value;\n";
			echo "document.exemplos.action = 'index.php?inc=spline.php&modo=exemplo'\n";
			echo "document.exemplos.submit();\n";
			echo "}\n";
			echo "</script>";
			echo "<input type=\"hidden\" name=\"id_bib\" value=\"".$id_bib."\">";
			echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
			echo "<input type=\"hidden\" name=\"indice\">";
			echo "</form>";
			echo $msg->get('Outros_Exemplos').":<br>";
            $objeto=new DOMDocument();
            $objeto->load($xml_file);
        	$filho = $objeto->getelementsbytagname("interpolation");
        	if ($filho->length > 0)
        	{
        		$interpol = $filho->item(0)->getelementsbytagname("interpol");
        		for ($i=0; $i<$interpol->length; $i++)
        		{
        			if ($i != 0) echo " | ";
        			if ($i == $indice) echo "<b>";
        			echo "<a href=\"javascript:criarLinks($i);\"><u>".($i+1)."</u></a>";
        			if ($i == $indice) echo "</b>";
            	}
        	}
		}
	   } //end if
	   echo "</body>";
	}
} else {
    if (!checaNumerico($x) || !checaNumerico($y) || !checaNumerico($valor))
    {
?>
        <p><font color="red"><?php echo $msg->get('Apenas_Dados_Numericos') ?></font></p>
        <p><input type="button" value="<?php echo $msg->get('Voltar') ?>" onclick="history.back()" class="button"></p>
<?php
    }
    else
    {
        //******************** ordena os dois vetores, com base nos valores de x[i] ********************
        $int_a = $a;
        $int_b = $b;
        for ($tam=$n; $tam>1; $tam--){
            for ($i=0; $i<$tam-1; $i++) {
                if ( $x[$i] > $x[$i+1] ) {
                    $aux = $x[$i];
                    $x[$i] = $x[$i+1];
                    $x[$i+1] = $aux;
                    $aux = $y[$i];
                    $y[$i] = $y[$i+1];
                    $y[$i+1] = $aux;
                }
            }
        }
        if ( ($valor<$x[0]) | ($valor>$x[$n-1]) )   {
            echo "<br>";
            echo "".$msg->get('SPLINE_MSG_24')."".($valor)."".$msg->get('SPLINE_MSG_25')."[".($x[0]).",".($x[$n-1])."].";
            echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
            echo "<input type=hidden name=n value=".($n).">";
            echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
            echo "<input type=hidden name=executar value=sim>";
            for ($i=0; $i<$n; $i++) {
                echo "<input type=hidden name=X[".($i)."] value=".($x[$i]).">";
                echo "<input type=hidden name=Y[".($i)."] value=".($y[$i]).">";
            } // end for
            echo "<p>";
            echo "<input class=button type=submit name=Submit value=".$msg->get('SPLINE_MSG_26').">";
            echo "<input type=hidden name=distribuicao value=".$distribuicao.">";
            echo "<input type=hidden name=funcao value=\"".$funcao."\">";
            echo "<input type=hidden name=a value=".$a.">";
            echo "<input type=hidden name=b value=".$b.">";
            echo "</form>";
        } else {
            //*************************** fim da ordenacao - inicio do programa ****************************
            for ($i=0; $i<=$n-2; $i++) {
                $h[$i] = $x[$i+1] - $x[$i];
            }
            @$c[1] = 2 * ($h[0] + $h[1]);
            for ($i=2; $i<=$n-2; $i++) {
                $c[$i] = 2 * ($h[$i-1] + $h[$i]) - (($h[$i-1])*($h[$i-1]) / $c[$i-1]);
            }
            for ($i=0; $i<=$n-2; $i++) {
                $b[$i] = 6 * ($y[$i+1] - $y[$i]) / $h[$i];
            }
            @$d[1] = $b[1] - $b[0];
            for ($i=2; $i<=$n-2; $i++) {
                $d[$i] = $b[$i] - $b[$i-1] - $h[$i-1] * $d[$i-1] / $c[$i-1];
            }
            $o[0] = 0;
            $o[$n-1] = 0;
            @$o[$n-2] = $d[$n-2]/$c[$n-2];
            for ($i=$n-3; $i>=1; $i--) {
                $o[$i] = ($d[$i] - $h[$i]* $o[$i+1]) / $c[$i];
            }
            //********************************* calculo dos polinomios *******************************
            for ($i=0; $i<$n-1; $i++) {
                $alpha[$i] = ( ($y[$i+1] - $y[$i]) / $h[$i] ) - ( ($o[$i+1] * $h[$i]) / 6 ) - ( ($o[$i] * $h[$i]) / 3 );
                $beta[$i] = $o[$i] / 2;
                $gama[$i] = ($o[$i+1] - $o[$i]) / (6 * $h[$i]);
            }
            //********************************* calculo do valor interpolado *******************************
            $xo = $x[0] + $h[0];
            for ($j=0; $j<=$n-2; $j++) {
                $i = $j;
            if ($valor <= $xo) $j = $n + 1;
            else $xo = $xo + $h[$j+1];
            }
            $i = $i + 1;
            $diferenca = $valor - $x[$i-1];
            $solucao = $y[$i-1] + $alpha[$i-1] * $diferenca + $beta[$i-1] * $diferenca * $diferenca + $gama[$i-1] * $diferenca * $diferenca * $diferenca;
            //************************************* Imprimir resultados ************************************
            echo "<br>";
            if ($_SESSION['ANAWEB']->RetornaModoExecucao() == "exemplo")
                verificaBib($xml_file);
            echo "<br>".$msg->get('SPLINE_MSG_19')."";
            echo "<br>";
            echo "<br><br><table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\"><tr><td align=\"center\" bgcolor=\"#ffffff\">".$msg->get('Indice')."</td><td align=\"center\" width=\"60\" bgcolor=\"#ffffff\">x</td><td align=\"center\" width=\"60\" bgcolor=\"#ffffff\">y</td></tr>";
            for ($j=0; $j<$n; $j++) {
                echo "<tr>";
                echo "<td align=\"center\" bgcolor=\"#ffffff\">$j</td><td align=\"center\" bgcolor=\"#ffffff\">".round($x[$j],4)."</td><td align=\"center\" bgcolor=\"#ffffff\">".round($y[$j],4)."</td>";
                echo "</tr>";
            } //for
            echo "</table>";
            echo "<br> <br>";
            echo "<b> <font face=Arial>".$msg->get('SPLINE_MSG_22')."</font> </b>";
            echo "<br> <br>";
            echo "".$msg->get('SPLINE_MSG_27')."[".($x[$i-1]).",".($x[$i])."] :";
            echo "<br> <br>";
            echo "p<sub>".($i)."</sub>(x) = ".(@$y[$i])." + ".(@$alpha[$i])."(x - ".(@$x[$i]).") + ".(@$beta[$i])."(x - ".(@$x[$i]).")<sup>2</sup> + ".(@$gama[$i])."(x - ".(@$x[$i]).")<sup>3</sup>";
            echo "<br><br>";
            echo "".$msg->get('SPLINE_MSG_28')."".($valor).", p(x) = ".($solucao).".";
            echo "<br> <br>";
            echo "<b> <font face=Arial> ".$msg->get('SPLINE_MSG_31')."";
            echo "</font> </b>";
            for($j=1;$j<$n;$j++)  {
                if ($j!=$i)  {
                    echo "<br> <br>";
                    echo "p<sub>".($j)."</sub>(x) = ".(@$y[$j])." + ".(@$alpha[$j])."(x - ".(@$x[$j]).") + ".(@$beta[$j])."(x - ".(@$x[$j]).")<sup>2</sup> + ".(@$gama[$j])."(x - ".(@$x[$j]).")<sup>3</sup>";
                } // end if
            } // end for
            $dados_grafico = "$n|";
            for ($i=0;$i<$n;$i++)  $dados_grafico .= "$x[$i]|";
            $dados_grafico .= "$valor|";
            for ($i=0;$i<$n;$i++)  $dados_grafico .= "$y[$i]|";
            $dados_grafico .= "$solucao|";
            $dados_grafico .= "$idioma|";
            if ($opcao_execucao == 1) $dados_grafico .= ":$funcao:|";
            $arquivo = gera_nome_arquivo();
            $conn = &ADONewConnection($A_DB_TYPE);
            $conn->PConnect($A_DB_HOST,$A_DB_USER,$A_DB_PASS,$A_DB_DB);
            $sql = "INSERT INTO grafico(id,dados) values ('".$arquivo."','".$dados_grafico."');";
            $rs = $conn->Execute($sql);
            if ($rs === false) die(A_LANG_LOGIN_MSG5);
            $rs->Close();
            echo "<table>";
            echo "<tr>";
            echo "<td><img src=spline_grafico.php?arquivo=".$arquivo."  border=0 align=left width=600 height= 400></td>";
            echo "</table>";
            echo "<br>";
            echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
            if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
            {
                echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
                echo "<input type=\"hidden\" name=\"indice\" value=\"$indice\">";
                echo "<input type=\"hidden\" name=\"navegacao\" value=\"sim\">";
            }
            echo "<input type=hidden name=n value=".($n).">";
            echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
            echo "<input type=hidden name=executar value=sim>";
            for ($i=0; $i<$n; $i++) {
                echo "<input type=hidden name=X[".($i)."] value=".($x[$i]).">";
                echo "<input type=hidden name=Y[".($i)."] value=".($y[$i]).">";
            } // end for
            if (isset($distribuicao)) echo "<input type=hidden name=distribuicao value=".$distribuicao.">";
            if (isset($funcao)) echo "<input type=hidden name=funcao value=\"".$funcao."\">";
            if (isset($int_a)) echo "<input type=hidden name=a value=".$int_a.">";
            if (isset($int_b)) echo "<input type=hidden name=b value=".$int_b.">";
            echo "<input class=button type=submit name=Submit value=".$msg->get('SPLINE_MSG_26').">";
            echo "</form>";
            echo "<p>";
                echo "<br>";
                echo $msg->get('G_PROXIMO_EXEMPLO');
                echo "<br><br>";
                // formul�io para efetuar o mesmo c�culo pelo m�odo de lagrange
            echo "<form method=post enctype=multipart/form-data action=index.php?inc=lagrange.php>";
        if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
        {
            echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
            echo "<input type=\"hidden\" name=\"indice\" value=\"$indice\">";
            echo "<input type=\"hidden\" name=\"navegacao\" value=\"sim\">";
        }
            echo "<input type=hidden name=n value=".($n).">";
            echo "<input type=hidden name=grau value=".($n-1).">";
            echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
            echo "<input type=hidden name=executar value=sim>";
            for ($i=0; $i<$n; $i++) {
                echo "<input type=hidden name=X[".($i)."] value=".($x[$i]).">";
                echo "<input type=hidden name=Y[".($i)."] value=".($y[$i]).">";
            } // end for
            echo "<input class=button type=submit name=Calcular value='".$msg->get('LAGRANGE_MSG_03')."'>";
            if (isset($distribuicao)) echo "<input type=hidden name=distribuicao value=".$distribuicao.">";
            if (isset($funcao)) echo "<input type=hidden name=funcao value=\"".$funcao."\">";
            if (isset($int_a)) echo "<input type=hidden name=a value=".$int_a.">";
            if (isset($int_b)) echo "<input type=hidden name=b value=".$int_b.">";
            echo "<input type=hidden name=valor value=".$valor.">";
            echo "</form>";
                // formul�io para efetuar o mesmo c�culo pelo m�odo de newton
            echo "<form method=post enctype=multipart/form-data action=index.php?inc=newton.php>";
        if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
        {
            echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
            echo "<input type=\"hidden\" name=\"indice\" value=\"$indice\">";
            echo "<input type=\"hidden\" name=\"navegacao\" value=\"sim\">";
        }
            echo "<input type=hidden name=n value=".($n).">";
            echo "<input type=hidden name=opcao_execucao value=".($opcao_execucao).">";
            echo "<input type=hidden name=executar value=sim>";
            for ($i=0; $i<$n; $i++) {
                echo "<input type=hidden name=X[".($i)."] value=".($x[$i]).">";
                echo "<input type=hidden name=Y[".($i)."] value=".($y[$i]).">";
            } // end for
            echo "<input class=button type=submit name=Calcular value='".$msg->get('NEWTON_MSG_03')."'>";
            if (isset($distribuicao)) echo "<input type=hidden name=distribuicao value=".$distribuicao.">";
            if (isset($funcao)) echo "<input type=hidden name=funcao value=\"".$funcao."\">";
            if (isset($int_a)) echo "<input type=hidden name=a value=".$int_a.">";
            if (isset($int_b)) echo "<input type=hidden name=b value=".$int_b.">";
            echo "<input type=hidden name=valor value=".$valor.">";
            echo "</form>";
            echo "<form method=post enctype=multipart/form-data action=index.php?inc=spline.php>";
            echo "<input class=button type=submit name=Submit value=".$msg->get('G_MSG_03').">";
            echo "</form>";
            if (isset($_POST["navegacao"]) && $_POST["navegacao"] == "sim")
            {
                echo "<form name=\"exemplos\" enctype=\"multipart/form-data\" method=\"post\">";
                echo "<script language=\"javascript\" type=\"text/javascript\">\n";
                echo "function criarLinks(value) {\n";
                echo "document.exemplos.indice.value = value;\n";
                echo "document.exemplos.action = 'index.php?inc=spline.php&modo=exemplo'\n";
                echo "document.exemplos.submit();\n";
                echo "}\n";
                echo "</script>";
                echo "<input type=\"hidden\" name=\"id_bib\" value=\"".@$id_bib."\">";
                echo "<input type=\"hidden\" name=\"xml_file\" value=\"".$xml_file."\">";
                echo "<input type=\"hidden\" name=\"indice\">";
                echo "</form>";
                echo $msg->get('Outros_Exemplos').":<br>";
                $objeto=new DOMDocument();
                $objeto->load($xml_file);
                $filho = $objeto->getelementsbytagname("interpolation");
                if ($filho->length > 0)
                {
                $interpol = $filho->item(0)->getelementsbytagname("interpol");
                    for ($i=0; $i<$interpol->length; $i++)
                    {
                        if ($i != 0) echo " | ";
                        if ($i == $indice) echo "<b>";
                        echo "<a href=\"javascript:criarLinks($i);\"><u>".($i+1)."</u></a>";
                        if ($i == $indice) echo "</b>";
                    }
                }
            }
        }// end else
    }
}
?>
</div>